package com.bwie.system.api;

import com.bwie.common.core.constant.ServiceNameConstants;
import com.bwie.common.core.domain.Result;
import com.bwie.system.api.factory.RemoteFileFallbackFactory;
import com.bwie.system.api.factory.RemoteSearchFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(contextId = "remoteSearchService", value = ServiceNameConstants.SEARCH_SERVICE, fallbackFactory = RemoteSearchFallbackFactory.class)
public interface RemoteSearchService {
    /**
     * 批量将选中的spu下的sku信息添加到es中
     * @return
     */
    @PostMapping("/es/save")
    public Result esSaveProduct(@RequestBody String skuEsModelList);

    /**
     * 根据spuId删除es中的sku信息
     * @param spuId
     * @return
     */
    @DeleteMapping("/es/del/{spuId}")
    public Result esDelProduct(@PathVariable(value = "spuId") Long spuId);
}
